package com.hgyc.mom.tool.strategy;

import com.hgyc.mom.tool.entity.AutoCodePart;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 编码规则组成日期生成实现类
 * @author fwj
 * @since 2025/5/8
 */
@Component
@Order(1)
public class PartTypeNowDateHandler implements PartTypeTemplate{

    @Override
    public String partHandle(AutoCodePart autoCodePart) {
        String formatDate = autoCodePart.getDateFormat();
        return DateTimeFormatter.ofPattern(formatDate).format(LocalDateTime.now());
    }

}
